package com.aps.apspda.adapter;

import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.aps.apspda.R;
import com.aps.apspda.entity.TabIndexGridEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * @author anyang
 * @date 2017/9/11
 * @desc
 */

public class TabIndexGridAdapter extends BaseQuickAdapter<TabIndexGridEntity, BaseViewHolder> {

    public TabIndexGridAdapter(@Nullable List<TabIndexGridEntity> data) {
        super(R.layout.adapter_tab_index_grid, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, final TabIndexGridEntity item) {
        TextView textView = helper.getView(R.id.tvTab);
        Drawable rightDrawable = mContext.getResources().getDrawable(item.getPicId());
        rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight());
        textView.setCompoundDrawables(null, rightDrawable, null, null);
        textView.setOnClickListener(item.getOnClickListener());
        textView.setText(item.getText());
    }
}
